#!/usr/bin/env python
# -*- coding: UTF-8 -*-
'''=================================================
@Project -> File   ：js逆向 -> 网易云
@IDE    ：PyCharm
@Author ：王启俊
@Date   ：2024-04-08 20:35
@Desc   ：
=================================================='''
import execjs
import requests
import json


def fn():
    Id = input("请输入歌曲id:::::")
    url = "https://music.163.com/weapi/comment/resource/comments/get?csrf_token="
    headers = {
        "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36"
    }
    # info ='{"ids": "[%s]", "level": "standard", "encodeType": "aac", "csrf_token": ""}'%Id

    cont = 1
    while True:
        info = '{"rid":"R_SO_4_191060","threadId":"R_SO_4_191060","pageNo":"%s","pageSize":"20","cursor":"1712660003436","offset":"0","orderType":"1","csrf_token":""}' % cont
        print(info)
        # with open('2.js', 'r', encoding='utf-8') as f:
        #     cx = execjs.compile(f.read())
        #     Jsondata = cx.call('encryptoMusicData', info)
        #     data = requests.post(url, headers=headers,
        #                          data=Jsondata, verify=False)
        #     lis = data.json().get('data').get('comments')
        #     for i in lis:
        #         print(i.get('content'))
        # cont +=1

if __name__ == '__main__':
    # get_music()
    fn()
